﻿
using UnityEngine;

public abstract class BundleInit : MonoBehaviour
{

    private float start_scale;
    protected bool isfocus = false;
    protected float focus_scale;

    public string imagePath;
    protected float currentTargetScale;
    protected float currentTargetShadowAlpha;
    protected float currentShadowAlpha;
    private float scale_tolorence = 10;
    private Vector3 img_plane_startscale;
    private float start_scale_tolorence = 1;
    protected Texture lastAlphaTex,lastColorTex;

    void Start()
    {
        Init();
    }

    protected virtual void FixSize(Vector2 texSize)
    {
        Vector2 finalQuadSize;
        float hwRadio = texSize.y / texSize.x;
        scale_tolorence = AppDataManager.Instance.GetCurrentPackageInfo().packageConfig.scaling_tolerance;
        if (hwRadio >= 1)
        {
            finalQuadSize = new Vector2(scale_tolorence / hwRadio, scale_tolorence);
        }
        else
        {
            finalQuadSize = new Vector2(scale_tolorence, scale_tolorence * hwRadio);
        }

        start_scale_tolorence = scale_tolorence;
        img_plane_startscale = transform.Find("Image").localScale = finalQuadSize;
    }

    public abstract void Init();

}
